<%@page import="entities.Website"%>
<%@page import="java.util.TreeMap"%>
<%
TreeMap<String, String> check = (TreeMap<String, String>) request.getAttribute("check");
String success = (String) request.getAttribute("success");
Website website = (Website) request.getAttribute("website");
String form = (String) request.getAttribute("form");
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/layouts/header.jsp" />
	
	<h3><span><%=form.equalsIgnoreCase("add") ? "Add Website" : "Edit Website" %></span></h2>
	
	<% if (success != null) {%>
	<div class="notification msgsuccess">
        <a class="close"></a>
        <p><%=success %></p>
    </div>
	<% } %>
	
	<form method="post" class="form-horizontal">
		<div class="control-group <%=check.get("domain") != null ? "error" : ""%>">
		    <label class="control-label" for="inputDomain">Websites</label>
		    <div class="controls">
		    	<input name="domain" type="text" id="inputDomain" placeholder="example.com" value="<%=website.getDomain() != null ? website.getDomain() : "" %>">
		      	<% if (check.get("domain") != null) { %>
		      	<span class="help-inline"><%=check.get("domain") %></span>
		      	<% } %>
		    </div>
		</div>
		
		<div class="control-group <%=check.get("title") != null ? "error" : ""%>">
		    <label class="control-label" for="inputTitle">Title for Email</label>
		    <div class="controls">
		    	<input name="title" type="text" id="inputTitle" placeholder="Input title" value="<%=website.getTitle() != null ? website.getTitle() : "" %>">
		      	<% if (check.get("title") != null) { %>
		      	<span class="help-inline"><%=check.get("title") %></span>
		      	<% } %>
		    </div>
		</div>
		
		<div class="control-group <%=check.get("status") != null ? "error" : ""%>">
		    <label class="control-label" for="inputStatus">Status</label>
		    <div class="controls">
		    	<select name="status">
		    		<option value="0" <%=website.getStatus()== 0 ? "selected=\"selected\"" : "" %>>Inactive</option>
		    		<option value="1" <%=website.getStatus()== 1 ? "selected=\"selected\"" : "" %>>Active</option>
		    	</select>
		      	<% if (check.get("status") != null) { %>
		      	<span class="help-inline"><%=check.get("status") %></span>
		      	<% } %>
		    </div>
		</div>
		
		<div class="control-group <%=check.get("sender") != null ? "error" : ""%>">
		    <label class="control-label" for="inputSender">Sender Email</label>
		    <div class="controls">
		    	<input name="sender" type="text" id="inputSender" placeholder="Input email sender" value="<%=website.getSender() != null ? website.getSender() : "" %>">
		      	<% if (check.get("sender") != null) { %>
		      	<span class="help-inline"><%=check.get("sender") %></span>
		      	<% } %>
		    </div>
		</div>
		
		<div class="control-group <%=check.get("contentUrl") != null ? "error" : ""%>">
		    <label class="control-label" for="inputContentUrl">Url Content Email</label>
		    <div class="controls">
		    	<input name="contentUrl" type="text" id="inputContentUrl" placeholder="Input url for get content" value="<%=website.getContentUrl() != null ? website.getContentUrl() : "" %>">
		      	<% if (check.get("contentUrl") != null) { %>
		      	<span class="help-inline"><%=check.get("contentUrl") %></span>
		      	<% } %>
		    </div>
		</div>
		
		<div class="control-group">
		    <div class="controls">
		      	<button type="submit" class="btn">Submit</button>
		    </div>
		</div>
		
	</form>
	
<jsp:include page="/layouts/footer.jsp" />